{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# errors"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## token"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "# %run -n main.py\n",
    "# lines = load_gz_lines(NAEVAL_TOKEN_TARGET)\n",
    "# targets = list(parse_partitions(lines))\n",
    "\n",
    "# lines = load_gz_lines(NAEVAL_TOKEN_PRED)\n",
    "# preds = list(parse_partitions(lines))\n",
    "\n",
    "# for target, pred in zip(targets, preds):\n",
    "#     if target != pred:\n",
    "#         show_partition(target)\n",
    "#         show_partition(pred)\n",
    "#         print()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## morph"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "# %run -n main.py\n",
    "# lines = load_gz_lines(NAEVAL_MORPH_TARGET)\n",
    "# items = parse_jl(lines)\n",
    "# targets = list(from_jsons(items, MorphMarkup))\n",
    "\n",
    "# lines = load_gz_lines(NAEVAL_MORPH_PRED)\n",
    "# items = parse_jl(lines)\n",
    "# preds = list(from_jsons(items, MorphMarkup))\n",
    "\n",
    "# for target, pred in zip(targets, preds):\n",
    "#     if target != pred:\n",
    "#         show_morph_markup_diff(target, pred)\n",
    "#         print()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## syntax"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "# %run -n main.py\n",
    "# lines = load_gz_lines(NAEVAL_SYNTAX_TARGET)\n",
    "# items = parse_jl(lines)\n",
    "# targets = list(from_jsons(items, SyntaxMarkup))\n",
    "\n",
    "# lines = load_gz_lines(NAEVAL_SYNTAX_PRED)\n",
    "# items = parse_jl(lines)\n",
    "# preds = list(from_jsons(items, SyntaxMarkup))\n",
    "\n",
    "# for target, pred in zip(targets, preds):\n",
    "#     if target != pred:\n",
    "#         show_syntax_markup_diff(target, pred)\n",
    "#         print()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## ner"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "# %run -n main.py\n",
    "# lines = load_gz_lines(NAEVAL_NER_TARGET)\n",
    "# items = parse_jl(lines)\n",
    "# markups = from_jsons(items, NERMarkup)\n",
    "# targets = list(iter_sents(markups))\n",
    "\n",
    "# lines = load_gz_lines(NAEVAL_NER_PRED)\n",
    "# items = parse_jl(lines)\n",
    "# markups = from_jsons(items, NERMarkup)\n",
    "# preds = list(iter_sents(markups))\n",
    "\n",
    "# # slovnet bert uses first 100 as test\n",
    "# for target, pred in zip(targets[:100], preds):\n",
    "#     if target != pred:\n",
    "#         show_ner_markup(target)\n",
    "#         print('>')\n",
    "#         show_ner_markup(pred)\n",
    "#         print('\\n\\n')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# sample"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "!mkdir -p sample"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "records = load_nerus(NERUS)\n",
    "records = list(head(records, 10))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%run -n main.py\n",
    "with capture(SAMPLE_NER):\n",
    "    for record in records:\n",
    "        record.ner.print()\n",
    "        print('\\n\\n')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%run -n main.py\n",
    "with capture(SAMPLE_MORPH):\n",
    "    for record in records:\n",
    "        for sent in record.sents:\n",
    "            sent.morph.print()\n",
    "            print()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "%run -n main.py\n",
    "with capture(SAMPLE_SYNTAX):\n",
    "    for record in records:\n",
    "        for sent in record.sents:\n",
    "            sent.syntax.print()\n",
    "            print()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
